<?php
/**
 * 验证是否唯一.
 * @param Model $model
 * @param array $attributes
 * @param string $field
 * @param string $bool
 * @return boolean
 */
function FUniqueValidator($model, &$attributes, $field, $bool)
{
	if ($bool)
	{
		if (isset($attributes[$field]))
			return $model->countByAttributes(array($field => $attributes[$field])) <= 0;
	}
	
	return true;
}
